﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace MidSoft.Web.Model_T_PET_TRANSFER
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtPET_TRANSFER_ID.Text.Trim().Length==0)
			{
				strErr+="ID不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtCURR_AREA_GRADE.Text))
			{
				strErr+="当前区域等级。格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtORIG_AREA_GRADE.Text))
			{
				strErr+="原区域第等级。格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtCURR_AREA.Text))
			{
				strErr+="当前区域。格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtORIG_AREA.Text))
			{
				strErr+="原区域。格式错误！\\n";	
			}
			if(this.txtCURR_OWNER.Text.Trim().Length==0)
			{
				strErr+="当前属主。不能为空！\\n";	
			}
			if(this.txtORIG_OWNER.Text.Trim().Length==0)
			{
				strErr+="原属主。不能为空！\\n";	
			}
			if(this.txtCURR_ADDRESS.Text.Trim().Length==0)
			{
				strErr+="当前地址。不能为空！\\n";	
			}
			if(this.txtCURR_CARD_NUM.Text.Trim().Length==0)
			{
				strErr+="当前卡号。不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtCURR_CARD_TYPE.Text))
			{
				strErr+="当前卡类型。格式错误！\\n";	
			}
			if(this.txtCURR_PET_ADD.Text.Trim().Length==0)
			{
				strErr+="当前宠物地址。不能为空！\\n";	
			}
			if(this.txtCURR_PHONE.Text.Trim().Length==0)
			{
				strErr+="当前电话。不能为空！\\n";	
			}
			if(this.txtCURR_POST_NUM.Text.Trim().Length==0)
			{
				strErr+="当前邮编。不能为空！\\n";	
			}
			if(this.txtNOTE.Text.Trim().Length==0)
			{
				strErr+="备注。不能为空！\\n";	
			}
			if(this.txtORIG_ADDRESS.Text.Trim().Length==0)
			{
				strErr+="原地址。不能为空！\\n";	
			}
			if(this.txtORIG_CARD_NUM.Text.Trim().Length==0)
			{
				strErr+="原证件号。不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtORIG_CARD_TYPE.Text))
			{
				strErr+="原证件类型。格式错误！\\n";	
			}
			if(this.txtORIG_PET_ADD.Text.Trim().Length==0)
			{
				strErr+="原宠物地址。不能为空！\\n";	
			}
			if(this.txtORIG_PHONE.Text.Trim().Length==0)
			{
				strErr+="原电话。不能为空！\\n";	
			}
			if(this.txtORIG_POST_NUM.Text.Trim().Length==0)
			{
				strErr+="原邮编。不能为空！\\n";	
			}
			if(this.txtPET_ID.Text.Trim().Length==0)
			{
				strErr+="犬只ID。不能为空！\\n";	
			}
			if(this.txtREG_ORG_ID.Text.Trim().Length==0)
			{
				strErr+="注册ID。不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtTRANSFER_DATE.Text))
			{
				strErr+="迁移日期。格式错误！\\n";	
			}
			if(this.txtTRANSFER_NO.Text.Trim().Length==0)
			{
				strErr+="迁移号。不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtTYPE.Text))
			{
				strErr+="类型。格式错误！\\n";	
			}
			if(!PageValidate.IsDateTime(txtCREATE_TIME.Text))
			{
				strErr+="创建时间。格式错误！\\n";	
			}
			if(this.txtCREATOR_ID.Text.Trim().Length==0)
			{
				strErr+="创建人ID。不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtUPDATE_TIME.Text))
			{
				strErr+="更新时间。格式错误！\\n";	
			}
			if(this.txtUPDATOR_ID.Text.Trim().Length==0)
			{
				strErr+="更新人ID。不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtID.Text))
			{
				strErr+="原ID格式错误！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			string PET_TRANSFER_ID=this.txtPET_TRANSFER_ID.Text;
			decimal CURR_AREA_GRADE=decimal.Parse(this.txtCURR_AREA_GRADE.Text);
			decimal ORIG_AREA_GRADE=decimal.Parse(this.txtORIG_AREA_GRADE.Text);
			decimal CURR_AREA=decimal.Parse(this.txtCURR_AREA.Text);
			decimal ORIG_AREA=decimal.Parse(this.txtORIG_AREA.Text);
			string CURR_OWNER=this.txtCURR_OWNER.Text;
			string ORIG_OWNER=this.txtORIG_OWNER.Text;
			string CURR_ADDRESS=this.txtCURR_ADDRESS.Text;
			string CURR_CARD_NUM=this.txtCURR_CARD_NUM.Text;
			decimal CURR_CARD_TYPE=decimal.Parse(this.txtCURR_CARD_TYPE.Text);
			string CURR_PET_ADD=this.txtCURR_PET_ADD.Text;
			string CURR_PHONE=this.txtCURR_PHONE.Text;
			string CURR_POST_NUM=this.txtCURR_POST_NUM.Text;
			string NOTE=this.txtNOTE.Text;
			string ORIG_ADDRESS=this.txtORIG_ADDRESS.Text;
			string ORIG_CARD_NUM=this.txtORIG_CARD_NUM.Text;
			decimal ORIG_CARD_TYPE=decimal.Parse(this.txtORIG_CARD_TYPE.Text);
			string ORIG_PET_ADD=this.txtORIG_PET_ADD.Text;
			string ORIG_PHONE=this.txtORIG_PHONE.Text;
			string ORIG_POST_NUM=this.txtORIG_POST_NUM.Text;
			string PET_ID=this.txtPET_ID.Text;
			string REG_ORG_ID=this.txtREG_ORG_ID.Text;
			DateTime TRANSFER_DATE=DateTime.Parse(this.txtTRANSFER_DATE.Text);
			string TRANSFER_NO=this.txtTRANSFER_NO.Text;
			decimal TYPE=decimal.Parse(this.txtTYPE.Text);
			DateTime CREATE_TIME=DateTime.Parse(this.txtCREATE_TIME.Text);
			string CREATOR_ID=this.txtCREATOR_ID.Text;
			DateTime UPDATE_TIME=DateTime.Parse(this.txtUPDATE_TIME.Text);
			string UPDATOR_ID=this.txtUPDATOR_ID.Text;
			decimal ID=decimal.Parse(this.txtID.Text);

			MidSoft.Model.Model_T_PET_TRANSFER model=new MidSoft.Model.Model_T_PET_TRANSFER();
			model.PET_TRANSFER_ID=PET_TRANSFER_ID;
			model.CURR_AREA_GRADE=CURR_AREA_GRADE;
			model.ORIG_AREA_GRADE=ORIG_AREA_GRADE;
			model.CURR_AREA=CURR_AREA;
			model.ORIG_AREA=ORIG_AREA;
			model.CURR_OWNER=CURR_OWNER;
			model.ORIG_OWNER=ORIG_OWNER;
			model.CURR_ADDRESS=CURR_ADDRESS;
			model.CURR_CARD_NUM=CURR_CARD_NUM;
			model.CURR_CARD_TYPE=CURR_CARD_TYPE;
			model.CURR_PET_ADD=CURR_PET_ADD;
			model.CURR_PHONE=CURR_PHONE;
			model.CURR_POST_NUM=CURR_POST_NUM;
			model.NOTE=NOTE;
			model.ORIG_ADDRESS=ORIG_ADDRESS;
			model.ORIG_CARD_NUM=ORIG_CARD_NUM;
			model.ORIG_CARD_TYPE=ORIG_CARD_TYPE;
			model.ORIG_PET_ADD=ORIG_PET_ADD;
			model.ORIG_PHONE=ORIG_PHONE;
			model.ORIG_POST_NUM=ORIG_POST_NUM;
			model.PET_ID=PET_ID;
			model.REG_ORG_ID=REG_ORG_ID;
			model.TRANSFER_DATE=TRANSFER_DATE;
			model.TRANSFER_NO=TRANSFER_NO;
			model.TYPE=TYPE;
			model.CREATE_TIME=CREATE_TIME;
			model.CREATOR_ID=CREATOR_ID;
			model.UPDATE_TIME=UPDATE_TIME;
			model.UPDATOR_ID=UPDATOR_ID;
			model.ID=ID;

			MidSoft.BLL.BLL_T_PET_TRANSFER bll=new MidSoft.BLL.BLL_T_PET_TRANSFER();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
